﻿<!-- 2017-12-7 14:56:03 | 修改 木遥（微信:  http://marsgis.cn/weixin.html ） -->
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="x5-fullscreen" content="true">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta name="description"
        content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS" />

    <link rel="shortcut icon" type="image/x-icon" href="http://cesium.marsgis.cn/favicon.ico">
    <title>动态线特效 |Mars3D ( MarsGIS for Cesium )|三维地图| 火星科技|合肥火星科技|合肥火星科技有限公司</title>



    <script type="text/javascript" src="../lib/include-lib.js" libpath="../lib/"
        include="jquery,font-awesome,bootstrap,layer,haoutil,turf,mars3d"></script>

    <link href="css/style.css" rel="stylesheet" />
</head>

<body class="dark">
    <!--加载前进行操作提示，优化用户体验-->
    <div id="mask" class="signmask" onclick="removeMask()"></div>

    <div id="cesiumContainer" class="mars3d-container"></div>



    <script type="text/javascript">
        $(document).ready(function () {
            if (!mars3d.util.webglreport()) {
                alert('系统检测到您使用的浏览器不支持WebGL功能');
                layer.open({
                    type: 1,
                    title: "当前浏览器不支持WebGL功能",
                    closeBtn: 0,
                    shadeClose: false,
                    resize: false,
                    area: ['600px', '200px'], //宽高
                    content: '<div style="margin: 20px;"><h3>系统检测到您使用的浏览器不支持WebGL功能！</h3>  <p>1、请您检查浏览器版本，安装使用最新版chrome、火狐或IE11以上浏览器！</p> <p>2、WebGL支持取决于GPU支持，请保证客户端电脑已安装显卡驱动程序！</p></div>'
                });
            }

            initMap();
        });

        function removeMask() {
            $("#mask").remove();
        }


        var viewer;
        //初始化地图
        function initMap() {
            //url传参，一个系统动态使用不同配置
            var configfile = haoutil.system.getRequestByName("config", "config/config.json");

            mars3d.createMap({
                id: 'cesiumContainer',
                url: configfile,
                center: { "y": 31.478058, "x": 117.285823, "z": 56479.37, "heading": 2.2, "pitch": -48.7, "roll": 0 },
                success: function (_viewer, jsondata) {//地图成功加载完成后执行
                    viewer = _viewer;

                    setTimeout(removeMask, 3000);
                    initWork();
                }
            });
        }



        //当前页面业务相关
        function initWork() {
            var dataSource = new Cesium.CustomDataSource();
            viewer.dataSources.add(dataSource);


            var startPoint = Cesium.Cartesian3.fromDegrees(117.025419, 32.00651, 51.2);
            var endPoint = Cesium.Cartesian3.fromDegrees(117.323963, 32.050384, 33.8);
            var positions = mars3d.polyline.getLinkedPointList(startPoint, endPoint, 20000, 50);//计算曲线点
            dataSource.entities.add({
                name: '1 空中彩色渐变颜色',
                polyline: {
                    positions: positions,
                    width: 10,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        duration: 3000, //时长，控制速度
                        url: 'img/textures/lineClr2.png'
                    }),
                }
            });


            var startPoint = Cesium.Cartesian3.fromDegrees(117.128446, 31.943352, 42.31);
            var endPoint = Cesium.Cartesian3.fromDegrees(117.410216, 31.975375, 37.53);
            var positions = mars3d.polyline.getLinkedPointList(startPoint, endPoint, 20000, 50);//计算曲线点
            dataSource.entities.add({
                name: '2 空中动态箭头',
                polyline: {
                    positions: positions,
                    width: 18,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.fromCssColorString("#a6d96a"),
                        repeat: new Cesium.Cartesian2(4.0, 1.0),
                        duration: 2000, //时长，控制速度
                        url: 'img/textures/arrow_1.png'
                    }),
                }
            });




            var startPoint = Cesium.Cartesian3.fromDegrees(117.281455, 31.896386, 22.64);
            var endPoint = Cesium.Cartesian3.fromDegrees(117.528249, 31.921552, 43.3);
            var positions = mars3d.polyline.getLinkedPointList(startPoint, endPoint, 20000, 50);//计算曲线点
            dataSource.entities.add({
                name: '3 空中流动线',
                polyline: {
                    positions: positions,
                    width: 6,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.CYAN,
                        duration: 5000, //时长，控制速度
                        url: 'img/textures/LinkPulse.png'
                    }),
                }
            });



            dataSource.entities.add({
                name: '4 地面流动线',
                polyline: {
                    positions: Cesium.Cartesian3.fromDegreesArrayHeights([
                        117.220337, 31.832987, 42.8,
                        117.220242, 31.835234, 45.6,
                        117.216263, 31.835251, 39.3,
                        117.217219, 31.819929, 35.8,
                        117.223096, 31.818342, 29.8,
                        117.249686, 31.818964, 40.1,
                        117.263171, 31.816664, 35.2,
                        117.278695, 31.816107, 35.5,
                        117.279826, 31.804185, 34.5,
                        117.286308, 31.804112, 29.2,
                        117.28621, 31.801059, 24.6
                    ]),
                    width: 5,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.fromCssColorString("#00ff00"),
                        duration: 7000, //时长，控制速度
                        url: 'img/textures/LinkPulse.png'
                    }),
                }
            });



            dataSource.entities.add({
                name: '5 地面动态箭头',
                polyline: {
                    positions: mars3d.pointconvert.lonlats2cartesians([[117.172852, 31.862736, 33.69], [117.251461, 31.856011, 26.44]]),
                    width: 6,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.fromCssColorString("#1a9850"),
                        duration: 2000, //时长，控制速度
                        url: 'img/textures/ArrowOpacity.png'
                    }),
                }
            });


            dataSource.entities.add({
                name: '6 地面椎状流动线',
                polyline: {
                    positions: mars3d.pointconvert.lonlats2cartesians([[117.358187, 31.838662, 12.23], [117.4384, 31.819405, 11.78]]),
                    width: 8,
                    clampToGround: true,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.fromCssColorString("#66bd63"),
                        repeat: new Cesium.Cartesian2(2.0, 1.0),
                        duration: 1000, //时长，控制速度
                        url: 'img/textures/line.png'
                    }),
                }
            });

            dataSource.entities.add({
                name: '7 地面流动渐变线',
                polyline: {
                    positions: mars3d.pointconvert.lonlats2cartesians([[117.348938, 31.805369, 7.63], [117.429496, 31.786715, 8.41]]),
                    width: 5,
                    clampToGround: true,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.CHARTREUSE,
                        duration: 3000, //时长，控制速度
                        url: 'img/textures/lineClr.png'
                    }),
                }
            });






        }





    </script>
</body>

</html>